Skip to content

Dependency resolution #3811

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft

Conversation

usagi32
Copy link
Contributor

@usagi32 usagi32 commented Apr 20, 2025

Motivation

Since linera is a directed acyclic graph, a block may depend on any number of blocks ancestrally or in parallel. For a working block exporter a block must be exported along with its set of all dependencies.

Proposal

Dependency resolution for the linera-exporter.
The testing can be done in a more extensive, exhaustive and randomized manner. This will have to be revisited in the future.
The unit test module can also use some re-factorization, this can be done in a separate PR, along with the rest of the binary crate.
This PR will also successfully close #3666.

Test Plan

unit tests

#[derive(Debug, Serialize, Deserialize, Clone)]
pub(super) struct Block {
pub(super) dependencies: DependencySet,
pub(super) destinatons: BTreeSet<DestinationId>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: destinatons (same below)

synchronized_blocks: HashSet::new(),
synchronized_blobs: HashSet::new(),
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Just derive Default and use it

guard
.save()
.await
.map_err(|e| Status::from_error(e.into()))?;
}
batch
};

// after implementation of future destinations
// this will be offloaded to a seperate thread.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: seperate

type Batch = Batch;
type Error = ExporterError;

async fn read_batch(&self, keys: Vec<Self::Key>) -> Result<Self::Batch, Self::Error> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like you may want to use read_confirmed_blocks and read_blobs (plural) here

/// The chain status, by chain ID.
state: ReentrantCollectionView<C, ChainId, ChainStatusView<C>>,
/// The block(and blob) index.
index: MapView<C, Key, Value>,
Copy link
Contributor

@ma2bd ma2bd Apr 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why mixing blocks and blobs vs using two maps?

}

#[derive(Debug, Serialize, Deserialize, Clone)]
pub(super) struct Block {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Block, Blob, Batchare used in different parts of the codebase with a different meaning. Can we use something different, maybeExporterBlock, ExporterBlob, ExporterBatch if we don't have any better idea?

match result {
None => Ok(None),
Some(Value::Blob(blob)) => Ok(Some(blob)),
_ => Err(ViewError::InconsistentEntries),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my question about the two maps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement the first Debug destination for the block exporter
2 participants